package ${serviceImplPackage};

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;

import org.spa.common.api.vo.Result;
import ${entityPackage}.${entity};
import ${mapperPackage}.${entity}Mapper;
import ${servicePackage}.${entity}Service;



/**
 * 描述: ${table.comment}
 * author: ${author}
 * date: ${date}
 */
@Service
public class ${entity}ServiceImpl implements ${entity}Service {

    @Autowired
	private ${entity}Mapper ${entity?uncap_first}Mapper;
	
	/**
	 * 添加
	 *
	 * @param testTabel
	 * @return
	 */
	@Transactional
	public Result<?> insert(${entity} ${entity?uncap_first}) {
<<<<<<< HEAD
	    ${entity?uncap_first}Mapper.insert(testTabel);
=======
>>>>>>> a803a56d3d5cd1ab7881efe406b39c3fcba3e907
	    return Result.resultOK("添加成功！");
	}
	
	/**
	 * 编辑
	 *
	 * @param ${entity?uncap_first}
	 * @return
	 */
	@Transactional
	public Result<?> updateById(${entity} ${entity?uncap_first}) {
	    ${entity?uncap_first}Mapper.updateById(${entity?uncap_first});
	    return Result.resultOK("编辑成功!");
	}
	
	/**
	 * 通过id删除
	 *
	 * @param id
	 * @return
	 */
	@Transactional
	public Result<?> deleteById(int id) {
	    ${entity?uncap_first}Mapper.deleteById(id);
	    return Result.resultOK("删除成功!");
	}
	
	/**
	 * 通过id查询
	 *
	 * @param id
	 * @return
	 */
	public Result<?> selectById(int id) {
	    ${entity} ${entity?uncap_first} = ${entity?uncap_first}Mapper.selectById(id);
	    return Result.resultOK(${entity?uncap_first});
	}
}